//
// Created by 29787 on 2023/12/26.
//
#ifndef ENCODER_UPRE_DECISION_H
#define ENCODER_UPRE_DECISION_H
#include "stm32f429xx.h"
#include "stdbool.h"
#include "cmsis_os.h"
#include "UPRE_AirCylinder.h"

#define AC_Claw_L1  OUT_7
#define AC_Claw_L2  OUT_6
#define AC_Claw_R1  OUT_5
#define AC_Claw_R2  OUT_3

typedef struct Motor_Set {
    int32_t posi_armr                 ;
    int32_t posi_arml                 ;
    int32_t vel_daj                   ;
    int32_t vel_vesc_trans            ;
    int32_t vesc_shoot                ;
}Motor_Set;

typedef struct Hand_Shank {
    uint8_t Mode_execute                    ;
    uint8_t num_fetch                       ;
    uint8_t num_lay                         ;
    uint16_t infrared_sensor_time_stamp     ;
    uint16_t Ac_time_stamp                  ;
    uint16_t Dc_time_stamp                  ;
    uint16_t Air_open_stamp                 ;
    uint32_t Stop_infrared_sensor_time_stamp;
    uint32_t Body_spin_time_stamp           ;
    float   Vel_x                           ;
    float   Vel_y                           ;
    bool    flag_body_spin                  ;
    bool    flag_stop_infrared_sensor       ;
    bool    is_start_chassic                ;
    bool    is_eat_ball                     ;
    bool    is_shoot_ball                   ;
    bool    is_accelerate                   ;
    bool    is_decelerate                   ;
    bool    flag_infrared_sensor            ;
    bool    flag_Ac                         ;
    bool    flag_Dc                         ;
    bool    flag_Air_open_stamp             ;
}Hand_Shank;

enum function{
    fetch_seeding               ,
    lay_seedings                ,
    shoot_ball                  ,
    Motor_Stop                  ,
    Motor_back                  ,
    execute_null                ,
    eat_ball                    ,
    Accelerate                  ,
    Dccelerate
};

void     Task_Decision();
void     Time_Stamp();
extern   Hand_Shank Pack_receive;
extern   Motor_Set  Motor_Set_param;
void up_pid();
void down_pid();
#endif //ENCODER_UPRE_DECISION_H
